Autoplace on horizontal surface API.#310
Conversation
| }, | ||
| ]; | ||
| options.setAppTitle('Model Viewer'); | ||
| options.world.enabled = true; |
There was a problem hiding this comment.
Btw, I think this is unnecessary. Can I remove it?
There was a problem hiding this comment.
I mean having .enabled on WorldOptions.
There was a problem hiding this comment.
Sure!
I don't think world should be explicitly enabled here --- this is a basic example without virtual / real world interaction.
There was a problem hiding this comment.
The placement requires plane tracking.
But I mean world itself doesn't do anything unless you also enable plane tracking or scene meshing so it seems redundant.
|
|
||
| if (this.placedObjects.has(model)) return; | ||
| this.placedObjects.add(model); | ||
| const placed = await xb.world.autoplaceOnHorizontalSurface(model, { |
There was a problem hiding this comment.
auto sounds redundant here.
it could be placeOnBestSurface ?
There was a problem hiding this comment.
I'll remove auto.
I think it's better to keep horizontal in case we want to have placeOnVerticalSurface in the future.
| * @param timeout - Optional timeout duration as a Temporal.Duration or Temporal.DurationLike object (defaults to 500ms). | ||
| * @returns A promise resolving to true if successfully placed, false otherwise. | ||
| */ | ||
| async autoplaceOnHorizontalSurface( |
| }, | ||
| ]; | ||
| options.setAppTitle('Model Viewer'); | ||
| options.world.enabled = true; |
There was a problem hiding this comment.
Sure!
I don't think world should be explicitly enabled here --- this is a basic example without virtual / real world interaction.
Adds a `xb.world.autoplaceOnHorizontalSurface` to place objects on horizontal planes. Updates the modelviewer sample to leverage this API to place each object. Replaces the cylinder in the model viewer sample with an animated torus to be more interesting. - Support optional semantic `label` on simulator planes in `SimulatorPlane`, `DetectedPlane`, and `SimulatorWorld` to allow custom floor/table categorization in emulator scenes. - Implement `getObjectBoundingBox` in `HorizontalAutoplacement` to exclude `ModelViewer` interaction handles (platform, rotation mesh) from collision boxes and bounding offsets. - Reuse pre-calculated `bbox` in `getObjectBoundingBox` to cleanly support Gaussian Splatting models without disappearing offsets. - Increase sampling `gridSteps` to 15 in `HorizontalAutoplacement` for tighter, high-precision object packing on tables. - Register simulated plane meshes inside the `PlaneDetector` map to allow dynamic targeting and visualization. - Swap cylinder mesh with animated, electric-teal `TorusKnotGeometry` in `ModelViewerScene` sample.
Adds a
xb.world.autoplaceOnHorizontalSurfaceto place objects on horizontal planes. Updates the modelviewer sample to leverage this API to place each object. Replaces the cylinder in the model viewer sample with an animated torus to be more interesting.labelon simulator planes inSimulatorPlane,DetectedPlane, andSimulatorWorldto allow custom floor/table categorization in emulator scenes.getObjectBoundingBoxinHorizontalAutoplacementto excludeModelViewerinteraction handles (platform, rotation mesh) from collision boxes and bounding offsets.bboxingetObjectBoundingBoxto cleanly support Gaussian Splatting models without disappearing offsets.gridStepsto 15 inHorizontalAutoplacementfor tighter, high-precision object packing on tables.PlaneDetectormap to allow dynamic targeting and visualization.TorusKnotGeometryinModelViewerScenesample.xrblocks_autoplace_objects_20250527.mp4